<layout name="no-slide"/>
<section class="block-item">
  <h3 class="title">总队长信箱开通了！</h3>
  <div class="content">
    还在为不明不白的处罚而烦恼吗？还在为不合理的交通设施感到头疼吗？让我们来帮助你！晓辉在路上栏目即日起和省公安厅交警总队联合开通《总队长信箱》，如果您在交警执法、道路设置等方面有意见和建议，可以通过“政法频道晓辉在路上”微信平台向我们提出，我们的记者会帮您交警总队联系，省交警总队的有关领导将直接过问，给予解决或解释。此外您还可以通过我们的热线电话60886666向我们反映。
  </div>
</section>
<section class="block-item">
  <h3 class="title">给总队长信箱写信</h3>
  <form id="form" class="form form-simple" method="post" action="__CONTROLLER__/save">
    
    <div class="form-item fun-grid">
      <label class="col-md-3">你的意见和建议</label>
      <p class="col-md-9">
        <textarea name="question" placeholder="请简单详细的描述你所要说的意见和建议"></textarea>
      </p>
    </div>
    
    <div class="form-item fun-grid">
      <label class="col-md-3">你的姓名</label>
      <p class="col-md-9">
        <input type="text" name="name">
      </p>
    </div>
    
    <div class="form-item fun-grid">
      <label class="col-md-3">联系方式</label>
      <p class="col-md-9">
        <input type="tel" name="tel" placeholder="为了我们可以和你取得联系">
      </p>
    </div>
    
    <div class="form-item fun-grid">
      <input type="hidden" name="sid" value="{$_GET['sid']}">
      <input type="hidden" name="open_id" value="{$open_id}">
      <p class="submit col-md-offset-3">
        <button class="btn btn-blue" type="submit">提交提问</button>
      </p>
    </div>
    
    <div class="form-item fun-grid">
      <p class="col-md-offset-3">
        <a href="__CONTROLLER__/feedbackList/sid/{$_GET['sid']}/open_id/{$open_id}">您也可以点击这里查看我的提问</a>
      </p>
    </div>
    
  </form>
</section>

<script type="text/javascript">
  (function(){
    // 加载modal.js
    GH.load( "js", "js-modal", "__COMMON__/js/modal.js" );

    var oForm = GH.$( "#form" ),
        formControl = GH.$$( "#form input" );
    oForm.addEventListener( "submit", fnSubmit, false );
    function fnSubmit( event ) {
      event.preventDefault();
      checkForm() && postForm.call( this );
    };
    function checkForm() {
      var canpost = true;
      [].forEach.call(formControl, function(item, index) {
        if ( !!!item.value.trim() && item.getAttribute("type") !== "hidden" ) {
          GH.showMessage( "请填写完整信息~~" );
          canpost = false;
          return false;
        };
      });
      return canpost;
    };
    function postForm() {
      var fm = GH.serialize( "form" );
      var url = this.getAttribute( "action" );
      GH.ajax(url, fm, function( data ) {
        modal.confirm({
          title: "提交结果",
          text: data.msg,
          buttons: [
            { text: "好的", close: true, click: goIndex },
            { text: "查看我的反馈", close: true, click: goList }
          ]
        });
      });
    };
    
    function goIndex() {
      window.location = "{:U('Site/index', 'sid='.$_GET['sid'])}";
    };
    function goList() {
        window.location = "__CONTROLLER__/feedbackList/sid/{$_GET['sid']}/open_id/{$open_id}";
    };
  })();
  
</script>
